/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * TrainingBook
 * Copyright (C) Arnaud Duval 2010 <arnaud.duval@gmail.com>
 * 
 * Projects is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Projects is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _ACTIVITY_EDIT_DIALOG_HPP_
#define _ACTIVITY_EDIT_DIALOG_HPP_

#include <gtkmm.h>
#include "double-entry.hpp"
#include "duration-entry.hpp"
#include <DateTimeEntry.hpp>
#include "integer-entry.hpp"
#include "activity-types.hpp"
#include <Activity.hpp>

///@class ActivityEditDialog
///@brief Dialog box for editing an activity
class ActivityEditDialog: public Gtk::Dialog
{
    public:
        ///@brief Constructor
        ActivityEditDialog(std::string titre, Gtk::Window *parent,
                           ActivityTypes actTypes);
        ///@brief Destructor
        virtual ~ActivityEditDialog();
        ///@brief Set the edited activity
        void SetActivity(ActivityHeader);
        ///@brief Return edited activity
        ActivityHeader GetActivity();
        ///@brief Update the content of dialog box with activity values
        void Update();
        ///@brief Update the activity values with the content of the dialog box
        void UpdateActivity();
        ///@brief Set the initial displayed date
        void SetDate(DateTime);
    protected:
        ///@brief Overwrite of method called at validation
        virtual void on_response(int);
        ///@brief Action for loading GPX file
        void on_button_load_gpx_clicked();
        ///@brief Action for plotting GPX elevation
        void on_button_plot_gpx_clicked();
        ///@brief Action for computing consuled calories
        void on_button_compute_calories_clicked();
        ///@brief Action when clicking on the date selection button
        void on_button_select_date_clicked();
        ///@brief Action when clicking on the button to unembed the GPS track
        void on_button_unembed_track_clicked();
        ///@brief Action when clicking on test button
        void on_button_test_clicked();
        ///@brief Fill the text labels
        void FillLabels();
    private:
        //Activity in edition
        ActivityHeader activity;

        //Vbox principale
        //Gtk::VBox mainVBox;
        
        //Saisie de la date
        Gtk::HBox dateHBox;
        Gtk::Label dateLabel;
        Gtk::Button dateButton;
        DateTimeEntry dateEntry;
        
        //Saisie de l'heure de début
        Gtk::HBox timeHBox;
        Gtk::Label timeLabel;
        DateTimeEntry timeEntry;
        
        //Saisie du lieu
        Gtk::HBox locationHBox;
        Gtk::Label locationLabel;
        Gtk::Entry locationEntry;
        
        //Saisie du type d'activité
        Gtk::HBox typeActHBox;
        Gtk::Label typeActLabel;
        Gtk::ComboBoxText typeActCBT;
        
        //Saisie de la distance
        Gtk::HBox distanceHBox;
        Gtk::Label distanceLabel;
        DoubleEntry distanceEntry;
        
        //Saisie de la durée
        Gtk::HBox durationHBox;
        Gtk::Label durationLabel;
        DurationEntry durationEntry;

        //Saisie de la fréquence cardiaque moyenne
        Gtk::HBox fcMoyHBox;
        Gtk::Label fcMoyLabel;
        IntegerEntry fcMoyEntry;

        //Saisie de la fréquence cardiaque maximale
        Gtk::HBox fcMaxHBox;
        Gtk::Label fcMaxLabel;
        IntegerEntry fcMaxEntry;

        //Saisie de la qualité développée
        Gtk::HBox qualityHBox;
        Gtk::Label qualityLabel;
        Gtk::ComboBoxText qualityCBT;

        //Saisie du nombre de calories dépensée
        Gtk::HBox caloriesHBox;
        Gtk::Label caloriesLabel;
        IntegerEntry caloriesEntry;
        Gtk::Button caloriesButton;
        
        //Chargement d'une trace GPS
        Gtk::HBox gpxHBox;
        Gtk::Label gpxLabel;
        Gtk::Button gpxButton;

        //Commentaires
        Gtk::VBox commentsVBox;
        Gtk::Label commentsLabel;
        Gtk::TextView commentsTextView;
        Glib::RefPtr<Gtk::TextBuffer> commentsTextBuffer;
        
        //Affichage du dénivelé de la trace GPS
        Gtk::HBox plotGpxHBox;
        Gtk::Button plotGpxButton;
        
        //Saisie du temps passé dans les différentes intensités de l'échelle ESIE
        Gtk::HBox intensitiesHBox;
        Gtk::VBox intensityVBoxes[7];
        Gtk::Label intensityLabels[7];
        DoubleEntry intensityEntries[7];

        //Bouton permettant de désencapsuler la trace
        Gtk::HBox unembedTrackHBox;
        Gtk::Button unembedTrackButton;

        //Ajout d'un bouton pour faire des tests
        Gtk::Button testButton;

};

#endif // _ACTIVITY_EDIT_DIALOG_HPP_
